import os
from os.path import join, getsize

tar = r"/home/http913/devportal/_site"

worry = r"https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"

right = r"https://cdn.bootcss.com/jquery/1.11.2/jquery.js"

for root, dirs, files in os.walk(tar):
    print(root)
    print(files)
    for file in files:
        file_path = join(str(root),file)
        file_data = ""
        if ".html" in file_path:
            with open(file_path, "r") as f1:
                for line in f1:
                    line = line.replace(worry,right)
                    file_data+=line
            f1.close()
            with open(file_path,"w") as f2:
                f2.write(file_data)
                print(file_path,"写入完成")
            f2.close()
